package com.bbzn.device.client.service.emq.order.impl.nb;

import com.alibaba.fastjson.JSONObject;
import com.bbzn.device.client.constant.DeviceConstant;
import com.bbzn.device.client.dataobject.SystemParam;
import com.bbzn.device.client.dto.weather.WeatherResult;
import com.bbzn.device.client.exception.DefinitException;
import com.bbzn.device.client.service.DeviceService;
import com.bbzn.device.client.service.GaodeMapApiService;
import com.bbzn.device.client.service.SystemParamByCacheService;
import com.bbzn.device.client.utils.OptionalBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: jcnehuang
 * @Date : 2021/4/9 11:05
 * @Version 1.0
 * WIFI定位
 */
@Slf4j
@Component
public class NbSetWeatherImpl extends BaseNbSendImpl {


    @Override
    public String checkMap(String language) throws Exception {
        if (!OptionalBean.ofNullable(map.get("area")).isPresent()) {
            throw new DefinitException(500, "地区不能为空");
        }
        if (!OptionalBean.ofNullable(map.get("temperature")).isPresent()) {
            throw new DefinitException(500, "室外温度不能为空");
        }
        if (!OptionalBean.ofNullable(map.get("time")).isPresent()) {
            throw new DefinitException(500, "时间不能为空");
        }
        if (!OptionalBean.ofNullable(map.get("weather")).isPresent()) {
            throw new DefinitException(500, "天气值不能问为空");
        }
        return JSONObject.toJSONString(map);
    }
}
